import qualified Git.Url as Url
import Utility.UserInfo
import Utility.Url.Parse
-import qualified Utility.RawFilePath as R
import qualified Utility.OsString as OS
{- Finds the git repository used for the cwd, which may be in a parent
- directory. -}
fromCwd :: IO (Maybe Repo)
-fromCwd = R.getCurrentDirectory >>= seekUp . toOsPath
+fromCwd = getCurrentDirectory >>= seekUp
where
seekUp dir = do
r <- checkForRepo dir
readSymbolicLink,
createSymbolicLink,
createLink,
- removeLink,
getFileStatus,
getSymbolicLinkStatus,
- doesPathExist,
- getCurrentDirectory,
- createDirectory,
setFileMode,
setOwnerAndGroup,
rename,
#ifndef mingw32_HOST_OS
import Utility.FileSystemEncoding (RawFilePath)
import System.Posix.Files.ByteString
-import qualified System.Posix.Directory.ByteString as D
-
--- | Checks if a file or directory exists. Note that a dangling symlink
--- will be false.
-doesPathExist :: RawFilePath -> IO Bool
-doesPathExist = fileExist
-
-getCurrentDirectory :: IO RawFilePath
-getCurrentDirectory = D.getWorkingDirectory
-
-createDirectory :: RawFilePath -> IO ()
-createDirectory p = D.createDirectory p 0o777
#else
import System.PosixCompat (FileStatus, FileMode)
getSymbolicLinkStatus p = P.getSymbolicLinkStatus . fromRawFilePath
=<< convertToWindowsNativeNamespace p
-doesPathExist :: RawFilePath -> IO Bool
-doesPathExist = D.doesPathExist . fromRawFilePath
-
-getCurrentDirectory :: IO RawFilePath
-getCurrentDirectory = toRawFilePath <$> D.getCurrentDirectory
-
-createDirectory :: RawFilePath -> IO ()
-createDirectory = D.createDirectory . fromRawFilePath
-
setFileMode :: RawFilePath -> FileMode -> IO ()
setFileMode p m = do
p' <- fromRawFilePath <$> convertToWindowsNativeNamespace p